home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / VMRMix / Demonstration.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  3KB  |  95 lines

  1. //------------------------------------------------------------------------------
  2. // File: Demonstration.h
  3. //
  4. // Desc: DirectShow sample code
  5. //       Header file and class description for CDemonstration, 
  6. //       "special effects" module to represent capabilities of VMR.
  7. //       This class is called from CVMRMixDlg by the "Play" button.
  8. //       CDemonstration contains CVMRCore member (VMR engine), through which 
  9. //       it performs initialization of the graph builder and presentation.
  10. //
  11. // Copyright (c) 2000-2001 Microsoft Corporation.  All rights reserved.
  12. //------------------------------------------------------------------------------
  13.  
  14. #ifndef HDR_DEMONSTRATION
  15. #define HDR_DEMONSTRATION
  16.  
  17. #include "stdafx.h"
  18.  
  19. class CVMRMixDlg;
  20.  
  21. class CDemonstration
  22. {
  23. private:
  24.     CVMRMixDlg *    m_pDlg;             // 'parent' dialog
  25.     char            m_szMsg[MAX_PATH];  // auxiliary string for debug messages
  26.     bool            m_bInitialized;     // true if graph is build and files are rendered;
  27.                                         // false otherwise
  28.     CMediaList      m_MList;            // media list to be played
  29.     CVMRCore *      m_pCore;            // 'main' class that implements VMR management
  30.     VMRALPHABITMAP  m_sBmpParams;       // used in IVMRMixerBitmap; parameters 
  31.                                         // of the bitmap overlapping the video
  32.     HBITMAP         m_hbmp;             // handle to the bitmap overlapping the video
  33.  
  34.     HRESULT SetAlphaBitmapColorKey(UINT ImageID);   // set color key for overlapping bitmap
  35.     HRESULT GetValidVMRBitmap(UINT ImageID);        // create bitmap compatible with renderer's settings
  36.  
  37. public:
  38.     CDemonstration( CVMRMixDlg * pDlg,      // 'parent' dialog
  39.                     CMediaList * pMajorList,// media list to play 
  40.                     int nSize,              // size of pMajorList
  41.                     HRESULT *phr) :         
  42.         m_pDlg(pDlg),
  43.         m_hbmp(NULL),
  44.         m_pCore(NULL),
  45.         m_bInitialized(false)
  46.     {
  47.         ASSERT(phr);
  48.         ASSERT( nSize > 0);
  49.  
  50.         strcpy( m_szMsg, "");
  51.  
  52.         *phr = S_OK;
  53.  
  54.         ZeroMemory( &m_sBmpParams, sizeof(VMRALPHABITMAP));
  55.         srand( clock());
  56.         
  57.         pMajorList->Shuffle();
  58.         if( false == pMajorList->Clone(nSize, &m_MList))
  59.         {
  60.             *phr = E_INVALIDARG;
  61.             return;
  62.         }
  63.     };
  64.     virtual ~CDemonstration()
  65.     {
  66.         if( m_pCore )
  67.         {
  68.             delete m_pCore;
  69.         }
  70.         if( m_hbmp)
  71.         {
  72.             DeleteObject( m_hbmp );
  73.         }
  74.         if( m_sBmpParams.hdc )
  75.         {
  76.             DeleteDC( m_sBmpParams.hdc );
  77.         }
  78.         m_MList.Clean();
  79.     };
  80.  
  81.     HRESULT Initialize(); 
  82.     HRESULT UpdateStreams(clock_t tStart);
  83.     virtual HRESULT Perform();
  84.  
  85.     // this function calculates parameters for the 'swirling windows' effect
  86.     void FountainPath(  long t, 
  87.                         long T, 
  88.                         int n, 
  89.                         NORMALIZEDRECT r0,  
  90.                         double A0, 
  91.                         NORMALIZEDRECT * pR, 
  92.                         double * pA);
  93. };
  94.  
  95. #endif